package com.mutual.base.views;

import java.io.PrintWriter;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.view.AbstractView;

import com.mutual.base.json.JsonBuilder;

/**
 * 自定义JSON视图
 * @create-time 2016年3月4日 上午11:15:05
 * @version     1.0
 */
public class CustomJsonView extends AbstractView{

	@Override
	protected void renderMergedOutputModel(Map<String, Object> model,HttpServletRequest request, HttpServletResponse response) throws Exception {
		JsonBuilder jb = new JsonBuilder();
		jb.setExcludeFields("class","className");//排除的Bean属性
		response.setContentType("text/json;charset=UTF-8");
		PrintWriter out = response.getWriter();
		
		out.print(jb.encode(model));
		
	}

}
